////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    WitchesAndWizardsGuts.h                                      //
//  Developer:				                                                  //
//  Create date:			                                                  //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Witches And Wizards.          //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        2010 - Riplife Gaming.  All rights reserved.						  //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__FOOTBALLFRENZYGUTS_H__)
#define __FOOTBALLFRENZYGUTS_H__

#define FREE_SPIN_ROUNDS 10

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "slotguts.h"
#include "getrand.h"

class FootballFrenzyGuts : public SlotGuts
{
public:
	FootballFrenzyGuts();

	virtual ~FootballFrenzyGuts();

private:
	// Shared enums between client and server
	#include "FootballFrenzyCommon.h"

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[][6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	// Helper functions for classifyStops.
	SpinResult getWildLineWinResult( uint8* stops, uint8 line );

	SpinResult getLineWinResultWithPossibleSubstitution( uint8* stops, uint8 line, uint8 testIcon, bool& bSubstitution );

	bool doesWildLineWinPayMore( SpinResult srWild, SpinResult srOther) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	SpinResult getScatterWinResult( SlotSpin* spin, uint8 testIcon, int32& scatterPositions ) const;
	
	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

	void initializeSubGame ( uint8 SetOfDowns );
	void endSubGame ( );

	virtual uint8 getRowCount();
	virtual SlotPaylinePosition *getPayline(uint8 paylineid, uint8 reelid);

	static int g_nReelFeatureType;

	enum PaylineFeatureTrigger
	{
		pftNone,
		pftNearMiss,
		pftFeatureTriggered
	};

	PaylineFeatureTrigger getPaylineFeatureTrigger( uint8 nPayline );
	//void setPaylineFeatureTrigger( uint8 nPayline, PaylineFeatureTrigger ePaylineResult );

	//int32 getNumFeatureRounds();
	void initializeNumFeatureRounds();
	//void incrementNumFeatureRounds();

	int32 getCurrentFeatureRound();
	//void initializeCurrentFeatureRound();
	void incrementCurrentFeatureRound();

	int32 getTotalPointsForRound();
	//void initializeTotalPointsForRound();

	int32 getCurrentShotsRemaining();
	//void initializeCurrentShotsRemaining();
	void decrementCurrentShotsRemaining();

	int32 getCurrentPoints();
	//void initializeCurrentPoints();
	void incrementCurrentPoints();

	bool getLastShotHit();
	void setLastShotHit( bool bLastShotHit );

	// Deal with Free spin possible substitutions or multiplier
	void evaluateWildExplosion(SlotSpin* spin);
	void evaluateAddedWilds(SlotSpin* spin);
	void evaluateWildExpand(SlotSpin* spin);
	void evaluateRandomMultiplier();

protected:
	//virtual int32 getNumLinesBet();

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

	virtual bool8 processClientData( uint8 bonusGameType, int32 bonusDataCount, int32 *bonusData );

	//virtual bool8 processClientData( uint8 bonusGameType, int32 bonusDataCount, int32 *bonusData );

protected:
	// Override these framework functions.
	virtual void preSpinClassifyResults( SlotSpin* spin );
    virtual void postSpinClassifyResults( SlotSpin* spin );

	virtual bool8 hasSavedGames();

	int32 getProgressiveValue();

	void evaluateFeatureReels(SlotSpin* spin);

	virtual void Debug_SetLoserStops( uint8* pStops );

	virtual void initDebugFunctionMap();

	enum
	{
		EVT_DEBUG_FUNCTION_FF_FREE_SPINS = 401,
		EVT_DEBUG_FUNCTION_FF_MULTIPLIER_2,
		EVT_DEBUG_FUNCTION_FF_MULTIPLIER_3,
		EVT_DEBUG_FUNCTION_FF_MULTIPLIER_4,
		EVT_DEBUG_FUNCTION_FF_MULTIPLIER_5,
		EVT_DEBUG_FUNCTION_FF_CREDITS_1,
		EVT_DEBUG_FUNCTION_FF_CREDITS_2,
		EVT_DEBUG_FUNCTION_FF_CREDITS_4,
		EVT_DEBUG_FUNCTION_FF_CREDITS_10,
		EVT_DEBUG_FUNCTION_FF_NO_FEATURE
	};

	void DebugFreeSpin_FF_FreeSpins( SlotSpin *spin );
	void DebugFreeSpin_FF_Multiplier_2( SlotSpin *spin );
	void DebugFreeSpin_FF_Multiplier_3( SlotSpin *spin );
	void DebugFreeSpin_FF_Multiplier_4( SlotSpin *spin );    
	void DebugFreeSpin_FF_Multiplier_5( SlotSpin *spin );    
	void DebugFreeSpin_FF_Credits_1( SlotSpin *spin );    
	void DebugFreeSpin_FF_Credits_2( SlotSpin *spin );    
	void DebugFreeSpin_FF_Credits_4( SlotSpin *spin );    
	void DebugFreeSpin_FF_Credits_10( SlotSpin *spin );    
	void DebugFreeSpin_FF_No_Feature( SlotSpin *spin );    

	bool8 NextDebugStopIsFeature();

	static int g_FF_FeatureType;

};  


#endif // !defined(__FOOTBALLFRENZYGUTS_H__)
